USE [ITViet]
GO

--------------------------------------------------
--				@tblCustomerOpinion
--------------------------------------------------
IF EXISTS (SELECT * FROM sys.objects WHERE object_id=object_id(N'[dbo].[_tblCustomerOpinion_GetBySearch]') and type IN (N'PC', N'P'))
DROP PROCEDURE [dbo].[_tblCustomerOpinion_GetBySearch]
GO

CREATE PROCEDURE [dbo].[_tblCustomerOpinion_GetBySearch]
(
	@FromDate DATETIME,
	@ToDate DATETIME,
	@Type CHAR(1),
	@IsActive BIT
)
AS
		SELECT * 
		FROM tblCustomerOpinion
		WHERE (@FromDate IS NULL OR dbo.F_GETDATE(@FromDate) <= dbo.F_GETDATE([Date])) AND
			  (@ToDate IS NULL OR dbo.F_GETDATE([Date]) <= dbo.F_GETDATE(@ToDate)) AND
			  (@Type = [Type] OR @Type IS NULL) AND
			  (@IsActive = [IsActive] OR @IsActive IS NULL)		 
GO

